{template '../../header'}
{template '../../left'}

<div class="card">
    <div class="card-header">
        栏目详情
    </div>
    <div class="card-body">
        <form method="post">
            <div class="row">
                <div class="col-6">
                    <div class="row">
                        <div class="form-group col-6">
                            <label>栏目名称</label>
                            <input class="form-control form-control-sm" name="title" type="text" value="{$detail['title']}" placeholder="建议4个字" />
                        </div>
                        <div class="form-group col-6">
                            <label>栏目简称</label>
                            <input class="form-control form-control-sm" name="short" type="text" value="{$detail['short']}" placeholder="手机端，建议2个字" />
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-6">
                            <label>父级栏目</label>
                            <select id="parent_id" name="parent_id" class="form-control form-control-sm">
                                <option value="0">--请选择--</option>
                                {loop $parents $parent}
                                <option value="{$parent['id']}" {if $detail['parent_id'] == $parent['id']}selected{/if}>{$parent['title']}</option>
                                {/loop}
                            </select>
                        </div>
                        <div class="form-group col-6">
                            <label>栏目标识</label>
                            <input class="form-control form-control-sm" name="name" type="text" value="{$detail['name']}" placeholder="栏目唯一标识，英文或拼音" />
                            <small class="text-secondary">不填默认为栏目名称拼音</small>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group col-6">
                            <label>是否显示</label>
                            <select name="state" class="form-control form-control-sm">
                                {loop $states $key $value}
                                <option value="{$key}" {if $detail['state']==$key}selected{/if}>{$value}</option>
                                {/loop}
                            </select>
                        </div>
                        <div class="form-group col-6">
                            <label>栏目类型</label>
                            <select name="type" class="form-control form-control-sm">
                                {loop $types $key $value}
                                <option value="{$key}" {if $detail['type']==$key}selected{/if}>{$value}</option>
                                {/loop}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>跳转地址</label>
                        <input class="form-control form-control-sm" name="url" type="text" value="{$detail['url']}" />
                        <small class="text-secondary">栏目类型为跳转时需要填写</small>
                    </div>
                    <div class="form-group">
                        <label>关键字</label>
                        <input class="form-control form-control-sm" name="keywords" value="{$detail['keywords']}" />
                    </div>
                    <div class="form-group">
                        <label>栏目简介</label>
                        <textarea class="form-control form-control-sm" name="description">{$detail['description']}</textarea>
                    </div>
                </div>
                <div class="col-6">
                    <div class="form-group">
                        <label>
                            图片
                            <span class="badge badge-pill badge-info" data-toggle="tooltip" data-placement="top" title="" data-original-title="格式：JPG，尺寸：360px x 240px">?</span>
                        </label>
                        <div class="form-control-static">
                            <label id="preview1" class="preview banner">
                                +<input type="file" id="file1" accept="image/*" />
                                <input type="hidden" id="thumb" name="thumb" value="{$detail['thumb']}" />
                            </label>
                            <script type="text/javascript">
                                var loading;
                                $("#file1").uploadImagePreview({
                                    destID: "preview1",
                                    imgUrl: "{$detail['thumb']}",
                                    server: "/admin/upload/base64?dir=cms/column/thumb",
                                    change: function (image) {
                                        $("#thumb").val(image);
                                    },
                                    startUpload: function () {
                                        loading = $.loading({title: '正在上传...'});
                                    },
                                    finishUpload: function () {
                                        loading.unloading();
                                    },
                                });
                            </script>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>
                            条幅
                            <span class="badge badge-pill badge-info" data-toggle="tooltip" data-placement="top" title="" data-original-title="格式：JPG，尺寸：1920px x 320px">?</span>
                        </label>
                        <div class="form-control-static">
                            <label id="preview2" class="preview banner">
                                +<input type="file" id="file2" accept="image/*" />
                                <input type="hidden" id="banner" name="image" value="{$detail['banner']}" />
                            </label>
                            <script type="text/javascript">
                                var loading;
                                $("#file2").uploadImagePreview({
                                    destID: "preview2",
                                    imgUrl: "{$detail['banner']}",
                                    server: "/admin/upload/base64?dir=cms/column/banner",
                                    change: function (image) {
                                        $("#banner").val(image);
                                    },
                                    startUpload: function () {
                                        loading = $.loading({title: '正在上传...'});
                                    },
                                    finishUpload: function () {
                                        loading.unloading();
                                    },
                                });
                            </script>
                        </div>
                    </div>
                </div>
            </div>
            <button type="submit" class="btn btn-success btn-sm"><i class="fa fa-save"></i> 保存</button>

        </form>
    </div>
</div>

{template '../../footer'}   